
import axios from 'axios';
class Axios {
	constructor() {
		this.axios = axios;
		this.interceptors();
	}
	get(url, conf) {
		return this.axios.get(url, conf);
	}
	post(url, data, conf) {
		return this.axios.post(url, data, conf);
	}
	interceptors() {
		this.axios.interceptors.request.use(
			config => {
				let token = '';
				if (token) {
					config.headers.vf = token;
				}
				return config;
			},
			err => {
				return Promise.reject(err);
			});
		this.axios.interceptors.response.use(
			response => {
				return response;
			},
			error => {
				// if (error.response) {
				// 	switch (error.response.status) {
				// 	case 401:
				// 		alert('1111111111111111');
				// 	}
				// }
				return Promise.reject(error.response.data);
			});
	}
}
export default new Axios();